create database [SiteApp] 

use  [SiteApp] 

create table [User]
(
[SID] [int] IDENTITY(1,1) NOT NULL,
[Name] nvarchar(500),
[Password] nvarchar(500),
[OpenId] nvarchar(500),
[Phone] nvarchar(500),
[Isenable] INT,
[Img] nvarchar(500),
[Address] nvarchar(500),
[CREATETIME] DATE
)


create table [Site]
(
[SID] [int] IDENTITY(1,1) NOT NULL,
[Name] nvarchar(500),
[Isenable] INT,
[CREATETIME] DATE
)



create table [UserSite]
(
[SID] [int] IDENTITY(1,1) NOT NULL,
[UserId] nvarchar(500),
[SiteId] nvarchar(500),
[CREATETIME] DATE
)

CREATE TABLE [dbo].Device(
	[SID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](500) NULL,
	[SiteId] [nvarchar](500) NULL,
	[Isenable] INT,
[CREATETIME] DATE
) ON [PRIMARY]
GO 

create table [Point]
(
[SID] [int] IDENTITY(1,1) NOT NULL,
[Type] int,
[DeviceId] nvarchar(500),
[Name] nvarchar(500),
[Point]  nvarchar(500),
Voltage nvarchar(500),
Createtime DATE,
)





  
CREATE TABLE [dbo].[PointForTemperature](
	[SID] [int] IDENTITY(1,1) NOT NULL,
	[PointId] [nvarchar](500) NULL,
	[Temperature] [nvarchar](500) NULL,
	[Humidity] [nvarchar](500) NULL,
	[Pressure] [nvarchar](500) NULL,
	[Moisture] [nvarchar](500) NULL,
	[Img] [nvarchar](500) NULL,
	[Createtime] [datetime] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[PointForSF6](
	[SID] [int] IDENTITY(1,1) NOT NULL,
	[PointId] [nvarchar](500) NULL,
	[Temperature] [nvarchar](500) NULL,
	[Humidity] [nvarchar](500) NULL,
	[Pressure] [nvarchar](500) NULL,
	[Moisture] [nvarchar](500) NULL,
	[Img] [nvarchar](500) NULL,
	[Createtime] [datetime] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[PointForInfrared](
	[SID] [int] IDENTITY(1,1) NOT NULL,
	[PointId] [nvarchar](500) NULL,
	[Temperature] [nvarchar](500) NULL,
	[Humidity] [nvarchar](500) NULL,
	[Pressure] [nvarchar](500) NULL,
	[Moisture] [nvarchar](500) NULL,
	[Img] [nvarchar](500) NULL,
	[Createtime] [datetime] NULL
) ON [PRIMARY]
GO 